import api from '../api'

// 管理用户登录
const login = function (params) {
  return api.postRequest(api.requestURL + 'sso/login', params, false, {'Content-Type': 'application/x-www-form-urlencoded'})
}

// 获取图片验证码
const validateCode = function (params) {
  return api.requestURL + 'sso/getVerifyCodeImage'
}

const getMenu = function (params) {
  //return api.getRequest(api.requestURL + 'admin-api/system/auth/list-menus', params)
  return api.getRequest(api.remoteDir + '/requestdata/menu.json', params)
}

const getUserInfo = function (params) {
  return api.getRequest(api.requestURL + 'app-api/member/user/get', params)
}

// 根据菜单获取当前用户的权限
const getPermissionList = function (params) {
  return api.getRequest(api.requestURL + 'web' + api.apiVer + 'menus/menus/' + params.id + '/btnCodes', params)
}

// 用户列表
const userList = function (params) {
  return api.postRequest(api.requestURL + 'travel/user/userList', params, false, {'Content-Type': 'application/json'})
}


// vip列表
const vipList = function (params) {
  return api.postRequest(api.requestURL + 'travel/vip/vipList', params,false, {'Content-Type': 'application/json'})
}

// pc二维码校验登录
const checkLoginByKey = function (params) {
  return api.getRequest(api.requestURL + 'app-api/member/wx-mp/check-login-by-key', params, {showMessage: false})
}



export default {
  login,
  validateCode,
  getMenu,
  getUserInfo,
  getPermissionList,
  userList,
  vipList,
  checkLoginByKey,
}
